package day05;
import java.util.Random;
public class MethodDemo2 {
	public static void main(String[] args) {
		int a = sum(7, 8);
		System.out.println(a);
		int m = 5, n = 6;
		int b = sum(m, n);
		System.out.println(b);
		
		int[] c = generateArray(10,30);
		System.out.println("数组长度为：" + c.length);
		for (int i = 0; i < c.length; i++) {
			System.out.println(c[i]);
		}
		
		System.out.println("-----------");
		
		
		int[] d = generateArray(5,12);
		System.out.println("第一个元素的值："+d[0]);
		for (int i = 0; i < d.length; i++) {
			System.out.println(d[i]);
		}
	}
	
	public static int[] generateArray(int len,int max){
		Random rand = new Random();
		int[] arr = new int[len];
		for (int i=0;i< arr.length;i++){
			arr[i] = rand.nextInt(max+1);
		}
		return arr;
	}
	
	
	public static int sum(int num1,int num2){
		int num = num1+num2;
		return num;
	}
	
}
